# -*- coding: utf-8 -*-
"""
__mktime__ = '2019/4/14'
__author__ = 'Just'
__filename__ = 'mh_image'
"""
from sqlalchemy import Column, Integer, String, orm, ForeignKey
from app.model.base import BaseModel, db


class ComicImage(BaseModel):
    """章节图片"""
    __tablename__ = 'comic_image'

    id = Column(Integer, primary_key=True, autoincrement=True)
    cid = Column(Integer, nullable=False, comment='漫画id')
    pid = Column(Integer, comment='图片对应的观看序号')
    image = Column(String(255), comment='图片的所在路径')
    sid = Column(Integer, ForeignKey('comic_section.sid'), nullable=False, comment='章节id')

    @orm.reconstructor
    def __init__(self):
        # 序列化列表
        self.fields = ['cid', 'sid', 'pid', 'image']
